package com.common.utils.db;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * @Author: zengliang
 * @Description: 数据库通用工具类
 * @Date:Created in 14:07 2022/4/28
 * @Modified By:
 */
public class Utils {

    /**
     * 按名称读取系统配置文件信息
     * @param name
     * @return
     */
   public String getSystemConfigurationForname(String name){
       String configurationValue = null;
       //读配置文件信息
       Properties p = new Properties();
       try {
           InputStream in = DB.class.getClassLoader().getResourceAsStream("config/db.properties");
           //据说这一句使用来读取中文用的
           BufferedReader bf = new BufferedReader(new InputStreamReader(in));
           p.load(bf);
           configurationValue = p.get(name).toString().trim();
       } catch (IOException e) {
           e.printStackTrace();
       }
       return configurationValue;
    }
}
